<!DOCTYPE html>
<html>
<head>
	<title>公告列表</title>
	<#include "/header.html">
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
</head>
<script type="text/javascript" charset="utf-8" src="${request.contextPath}/statics/plugins/layui/layui.js"></script>
<link rel="stylesheet" href="${request.contextPath}/statics/plugins/layui/css/layui.css">
<script>
	//编辑器
	var active;
	layui.use('layedit', function(){
		var layedit = layui.layedit;
		//构建一个默认的编辑器
		var index = layedit.build('content',{
			tool: [
				'strong' //加粗
				,'italic' //斜体
				,'underline' //下划线
				,'del' //删除线
				,'|' //分割线
				,'left' //左对齐
				,'center' //居中对齐
				,'right' //右对齐
				,'link' //超链接
				,'unlink' //清除链接
				,'help' //帮助
			]
		});
		active = {
			content: function(){
				return layedit.getContent(index); //获取编辑器内容
			}
			,text: function(){
				return layedit.getText(index); //获取编辑器纯文本内容
			}
			,selection: function(){
				return layedit.getSelection(index);
			}
		};
		layedit.set({
			//暴露layupload参数设置接口 --详细查看layupload参数说明
			uploadImage: {
				url: '${request.contextPath}/sys/slideshow/fileUploadJson/'    //上传接口url
				,type: 'post', //默认post
				auto: false, //一定要写这个,不能会自动触发上传
				done: function (res) {                      //传输完成的回调
					console.log(res.msg)
				},
				error: function () {                         //传输失败的回调
					//请求异常回调
				}
			}
			, devmode: true
			//插入代码设置
			, codeConfig: {
				hide: true,  //是否显示编码语言选择框
				default: 'javascript' //hide为true时的默认语言格式
			}
			,height: 500, //设置编辑器高度
		});
	});
</script>
<body>
<div id="rrapp" v-cloak>
	<div v-show="showList">
		<div class="grid-btn">
			<div class="form-group col-sm-2">
				<input type="text" class="form-control" v-model="q.title" @keyup.enter="query" placeholder="标题">
			</div>
			<a class="btn btn-default" @click="query">查询</a>
			<#if shiro.hasPermission("sys:noticeuser:update")>
			<a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
		</#if>
		<#if shiro.hasPermission("sys:noticeuser:update")>
		<a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
	</#if>
	<#if shiro.hasPermission("sys:noticeuser:delete")>
	<a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
</#if>
</div>
<table id="jqGrid"></table>
<div id="jqGridPager"></div>
</div>

<div v-show="!showList" class="panel panel-default">
	<div class="panel-heading">{{title}}</div>
	<form class="form-horizontal">
		<div class="form-group">
			<div class="col-sm-2 control-label">标题</div>
			<div class="col-sm-10">
				<input type="text" class="form-control" v-model="noticeuser.title" placeholder="标题"/>
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-2 control-label">类型</div>
			<label class="radio-inline">
				<input type="radio" name="type" value="1" v-model="noticeuser.type"/> 纯文本
			</label>
			<label class="radio-inline">
				<input type="radio" name="type" value="2" v-model="noticeuser.type"/> 资讯链接
			</label>
		</div>
		<div class="form-group">
			<div class="col-sm-2 control-label">标签</div>
			<label class="radio-inline">
				<input type="radio" name="tag" value="1" v-model="noticeuser.tag"/> 不添加
			</label>
			<label class="radio-inline">
				<input type="radio" name="tag" value="2" v-model="noticeuser.tag"/> New
			</label>
			<label class="radio-inline">
				<input type="radio" name="tag" value="3" v-model="noticeuser.tag"/> hot
			</label>
		</div>
		<div class="form-group">
			<div class="col-sm-2 control-label">内容</div>
			<div class="col-sm-10">
				<div style="width:824px;min-height:100px;">
					<fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
						<legend></legend>
					</fieldset>

					<textarea class="layui-textarea" id="content" style="display: none">
					  把编辑器的初始内容放在这textarea即可
					</textarea>
				</div>
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-2 control-label"></div>
			<input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
			&nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
		</div>
	</form>
</div>
</div>

<script src="${request.contextPath}/statics/js/modules/sys/noticeuser.js?_${.now?long}"></script>
</body>
</html>